﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenNETCF.MTConnect;
using OpenNETCF.IoC;
using MachineSimulator.Interfaces;

namespace SimulatorAdapter
{
    public class Y : HostedLinearBase
    {
        private int m_act = 0;
        private int m_com = 0;

        public Y()
            : base("y1")
        {
            this.Name = "Y";
        }

        public override ComponentType ComponentType
        {
            get { return ComponentType.Linear; }
        }

        [SampleDataItem(UnitValues.Millimiter,
            ItemType = DataItemType.POSITION,
            ItemSubType=DataItemSubtype.ACTUAL
            )]
        public int Yact
        {
            get { return m_act; }
            set
            {
                // only publish value changes
                if (value == m_act) return;

                // store the new value
                m_act = value;

                // calling this will notify the underlying Agent engine to publish this value out the MTConnect protocol interface
                RaisePropertyChanged("Yact");
            }
        }

        [SampleDataItem(UnitValues.Millimiter,
            ItemType = DataItemType.POSITION,
            ItemSubType = DataItemSubtype.COMMANDED
            )]
        public int Ycom
        {
            get { return m_com; }
            set
            {
                // only publish value changes
                if (value == m_com) return;

                // store the new value
                m_com = value;

                // calling this will notify the underlying Agent engine to publish this value out the MTConnect protocol interface
                RaisePropertyChanged("Ycom");
            }
        }
    }
}
